import React from 'react';
import { Result } from 'antd';
import AcceptPage from './AcceptPage';
import RejectPage from './RejectPage';
import ConfirmPage from './ConfirmPage';
import ConfirmReject from './ConfirmReject';
import styles from './index.less';

export default function PC({
    offerEffectiveValue,
    setOfferEffectiveValue,
    location,
    setStatus,
    status,
    // companyName,
    setCompanyName
}) {
    const { query } = location;
    const { action } = query;
    const expirePage = <Result status="error" title={`超过${offerEffectiveValue}小时未确认，链接已失效！`} />;
    const isDetailPage = action === 'detail';

    // const title = <div className={styles.docTitle}>{`欢迎加入${companyName || ''}，请确认您的录用信息`}</div>;

    if (isDetailPage) {
        return (
            <div className={styles.hireConfirmWrap}>
                {/* {title} */}
                <ConfirmPage
                    setCompanyName={setCompanyName}
                    setStatus={setStatus}
                    setOfferEffectiveValue={setOfferEffectiveValue}
                    location={location}
                    isDetailPage
                />
            </div>
        );
    }
    if (status === 'expire') {
        return expirePage;
    }
    return (
        <div className={styles.hireConfirmWrap}>
            {/* {title} */}
            {!status && (
                <ConfirmPage
                    setCompanyName={setCompanyName}
                    setStatus={setStatus}
                    setOfferEffectiveValue={setOfferEffectiveValue}
                    location={location}
                />
            )}
            {status === 'accept' && <AcceptPage setCompanyName={setCompanyName} />}
            {status === 'confirmReject' && (
                <ConfirmReject setCompanyName={setCompanyName} location={location} setStatus={setStatus} />
            )}
            {status === 'reject' && <RejectPage setCompanyName={setCompanyName} />}
        </div>
    );
}
